function logs(s){
	uexLog.sendLog(s);
}

function getJsonErr(s,cb){
	var str = '返回数据有误！';
	if(s.status=='-1') str = '无网络，连接失败！';
	uexWindow.toast('0','5',str,"1500");
	if(cb=='up'){
		resetBV('1');
	}else if(cb=='down'){
		resetBV('0');
		}
}

function setstorage(objName,objValue){
	var sto = window.localStorage;
	if(sto) sto.setItem(objName,objValue);
}
function getstorage(objName){
	var ret = '';
	var sto = window.localStorage;
	if(sto) ret=sto.getItem(objName);
	return ret;
}
function clearstorage(objName){
	var sto = window.localStorage;
	if(sto){
		if(objName) sto.removeItem(objName);
		else storage.clear();
	}
}

function loadLink(url){
	var appInfo = ''; 
	var filter = '';
	var dataInfo = url.toLowerCase();
	var pf = getstorage('platform');
	if(pf==1){
		appInfo = 'android.intent.action.VIEW';
		filter = 'text/html';
	}
	if(dataInfo.indexOf('http://')<0 && dataInfo.indexOf('https://')<0){
		dataInfo = 'http://'+dataInfo;
	}
	uexWidget.loadApp(appInfo, filter, dataInfo);
}

//删除文件所在目录
function delFileDir(file){
	uexFileMgr.deleteFileByPath(file.substr(0,file.lastIndexOf('/')));
}

//去掉所有的html标记
function delHtmlTag(str){
	return str.replace(/<[^>]+>/g,"");
}

function setHtml(id, html) {
	if ("string" == typeof(id)) {
		var ele = $$(id);
		if (ele != null) {
			ele.innerHTML = html == null ? "" : html;
		}
	} else if (id != null) {
		id.innerHTML = html == null ? "" : html;
	}
}

function getValue(id){
	var e = $$(id);
	if(e) return e.value;
}

function setValue(id, vl){
	var e = $$(id);
	if(e) e.value = vl;
}

function user_info(friend_id){
	localStorage['friend_id'] = friend_id;
	if(localStorage['friend_id'] == localStorage['uid']){
		uexWindow.open('user', '0', 'user.html', 2, '', '', 0x0);
	}else{
		uexWindow.open('userother', '0', 'userother.html', 2, '', '', 0x0);
	}
}



function urlParse(url){
	var params = {};
	var loc = String(url);
	var pieces = loc.substr(loc.indexOf('?') + 1).split('&');
	params.keys = [];
	for (var i = 0; i < pieces.length; i += 1) {
		var keyVal = pieces[i].split('='); 
		params[keyVal[0]] = decodeURIComponent(keyVal[1]);
		params.keys.push(keyVal[0]);
	}
	return params;
}